package pub.fjf.http;

import java.util.HashMap;

public class Session {
	private long createTime;
	private long lastVisitedTime;
	private String sessionID;
	private HashMap<String,Object> data;
	Session() {
		this.createTime=System.currentTimeMillis();
		this.lastVisitedTime=this.createTime;
		this.sessionID="t"+this.createTime+"n"+(int)(Math.random()*32768);
		this.data=new HashMap<String,Object>();
	}
	public long getCreateTime() {
		return this.createTime;
	}
	public String getSessionID() {
		return sessionID;
	}
	
	public long getLastVisitedTime() {
		return lastVisitedTime;
	}
	public void setLastVisitedTime(long lastVisitedTime) {
		this.lastVisitedTime = lastVisitedTime;
	}
	public void setSessionID(String sessionID) {
		this.sessionID = sessionID;
	}
	public void setData(String key, Object value) {
		this.data.put(key, value);
	}
	public Object getData(String key) {
		return this.data.get(key);
	}
	public void removeData(String key) {
		this.data.remove(key);
	}
}
